package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2023-11-22
 * Time: 16:41
 */
class Animal{
    public String name;
    public int age;

    public Animal(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("111");
    }
}

class Dog extends Animal{
    public Dog(String name, int age){
        super(name, age);
        System.out.println("222");
    }
    public void print (){
        System.out.println(this.age+"的"+this.name +"正在汪汪汪");
    }
}
public class Test2 {
    public static void main(String[] args) {
        Dog dog = new Dog("xiaohei",3);
        dog.print();

        dog.age  =2;
    }
}
